﻿// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.

using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using Microsoft.Windows.Design.PropertyEditing;

namespace Expression.Samples.Interactivity.Design {
	public class GesturePointListEditor : PropertyValueEditor {
		private DataTemplate DataTemplate {
			get {
				DataTemplate template = new DataTemplate();
				template.VisualTree = new FrameworkElementFactory(typeof(WorkaroundInkCanvas));
				template.VisualTree.SetBinding(InkCanvas.StrokesProperty, new Binding() {
					Mode = BindingMode.TwoWay,
					UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
					Path = new PropertyPath("Value"),
					Converter = new InkStrokeConverter(),
					ConverterParameter = template.VisualTree
				});
				return template;
			}
		}

		public GesturePointListEditor() {
			this.InlineEditorTemplate = this.DataTemplate;
		}
	}
}
